BEGIN TRANSACTION;
BEGIN TRY
    -- 迁移用户数据
    INSERT INTO NewUsers (UserID, Name)
    SELECT UserID, Name FROM OldUsers;

    -- 迁移订单数据
    INSERT INTO NewOrders (OrderID, UserID)
    SELECT OrderID, UserID FROM OldOrders;

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    ROLLBACK TRANSACTION;
    PRINT '迁移失败：' + ERROR_MESSAGE();
END CATCH;
